Assemblers

  • An assembler is a tool that translates assembly language into machine code for a specific architecture like x86-64.

  • For the same architecture, register names are usually the same, but syntax may differ depending on the assembler.

  • Software that turns assembly code into binary ( .obj , .exe )

NASM (Netwide Assembler)

  • Open-source, simple, and cross-platform.

  • NASM is licensed under the "simplified" (2-clause) BSD license .

  • NASM is typeless

  • No semantic alias like real8

  • Instructions determine interpretation

  • NASM

  • NASM

  • NASM Download

  • NASM Docs

  • Syntax :

    • Intel Syntax

  • Architectures supported :

    • x86 (16-bit, 32-bit, 64-bit) β€” primary focus

    • x86-64 (AMD64 / Intel 64)

    • IA-32 real mode, protected mode, long mode

    • Limited support for NASM extensions for other architectures is generally experimental.

  • Output formats :

    • ELF (Linux)

    • COFF (Windows)

    • Win32/Win64 PE

    • Mach-O (macOS)

    • BIN (raw binary)

    • MZ (DOS COM/EXE)

    • OMF (OS/2)

  • Platforms supported :

    • Windows

    • Linux

    • macOS

    • BSD variants

    • DOS

YASM

  • Designed as a drop-in NASM replacement with extended features.

  • YASM emphasizes better modularity and maintainability, plus full support for NASM syntax.

  • It adds better support for modern assemblers and debugging info, e.g., for DWARF2/3.

  • YASM is a complete rewrite of the NASM assembler under the β€œnew” BSD License (some portions are under other licenses, see COPYING for details).

  • YASM currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats.

  • YASM can be easily integrated into Visual Studio 2005/2008 and 2010 for assembly of NASM or GAS syntax code into Win32 or Win64 object files.

  • YASM

  • YASM Manual

  • Syntax :

    • Intel Syntax

  • Architectures supported :

    • x86 (16/32/64-bit)

    • x86-64

    • YASM has experimental support for other target architectures via plugins, but x86/x86-64 is primary.

  • Output formats :

    • ELF (32/64)

    • COFF (32/64)

    • Mach-O

    • Win32/Win64 PE

    • BIN

    • OMF

    • Additional support for debugging formats (DWARF, STABS)

  • Platforms supported :

    • Windows

    • Linux

    • macOS

    • BSD

    • DOS

FASM (Flat Assembler)

  • Lightweight assembler, cross-platform.

  • Syntax is closer to NASM, sometimes simpler.

  • FASM is mostly used for size-critical or OS-level programming, like bootloaders, tiny OS kernels, or highly optimized code.

  • flat assembler

  • fasm handbook .

  • Architectures supported :

    • x86 (16/32-bit)

    • x86-64 (AMD64 / Intel 64)

    • Limited 16-bit real mode, 32-bit protected mode, 64-bit long mode

    • FASM does not support other architectures beyond x86/x86-64.

  • Output formats :

    • Flat binary (BIN)

    • ELF (32/64-bit)

    • Win32/Win64 PE

    • COM / EXE (DOS)

    • OBJ (COFF/Microsoft OMF-style object files)

  • Platforms supported :

    • Windows (primary)

    • Linux (via ELF output)

    • DOS

    • FreeBSD / other Unix-like systems (less common, mostly via cross-compilation)

  • Key differences vs NASM/YASM :

    • Self-hosting: FASM can assemble itself.

    • Macro-rich: Very powerful macro system.

    • No external linker required for many outputs (can produce binaries directly).

    • Strict syntax: Slightly different from NASM; more rigid but concise.

GAS (GNU Assembler)

  • The assembler component of the GNU toolchain.

  • Its job is to:

    • Take assembly language source code as input

    • Translate it into machine code (object files)

    • Typically output .o files used later by a linker

  • A common pipeline looks like:

    • C/C++ compiler (e.g., GCC)

      • β†’ generates assembly

    • GAS (as)

      • β†’ converts assembly to object code

    • Linker (e.g., GNU ld)

      • β†’ produces the final executable

  • GAS is strongly directive-based, not alias-based

  • Architectures supported :

    • x86 family

    • i386, i486, i586, i686

    • x86-64 (AMD64)

    • ARM family

    • ARM (A32)

    • Thumb (T32)

    • AArch64 (ARM64)

    • RISC architectures

    • RISC-V (32/64-bit)

    • MIPS

    • SPARC (32/64)

    • PowerPC / PowerPC64

    • Embedded / microcontroller

    • AVR (Atmel)

    • MSP430

    • Xtensa (used in ESP chips)

    • Legacy / less common

    • Alpha

    • HPPA (PA-RISC)

    • m68k (Motorola 68000)

    • SuperH (SH)

    • VAX

    • CRIS

    • Nios II

    • Exact availability depends on how binutils is configured (--target=...)

    • Some architectures are deprecated but still present in older versions

  • Output formats :

    • ELF (Executable and Linkable Format)

      • Default on Linux and most Unix-like systems

    • COFF (Common Object File Format)

    • PE/COFF

      • Used on Windows (via MinGW / Cygwin)

    • a.out

      • Historical format (rare today)

    • ECOFF (MIPS legacy systems)

    • XCOFF (AIX on PowerPC)

    • S-records / Intel HEX (for embedded targets, via objcopy stage typically)

  • Platforms supported :

    • Linux

    • macOS (via GNU toolchain or cross tools)

    • Windows

    • Native (MinGW, Cygwin)

    • Cross-compilation setups

    • BSD variants (FreeBSD, NetBSD, OpenBSD)

    • Bare-metal targets (no OS)

    • RTOS-based systems (FreeRTOS, Zephyr, etc.)

    • Vendor SDK toolchains (ARM GCC, RISC-V GCC, etc.)

MASM (Microsoft Macro Assembler)

  • Part of Visual Studio or the Windows SDK.

  • Produces .obj files compatible with MSVC linker.

  • Syntax is slightly different from NASM (Intel style, but directives like dq  vs DD  differ).

  • Example workflow:

    ml64 /c main.asm       ; assemble to main.obj
    link main.obj raylib.lib opengl32.lib gdi32.lib winmm.lib /SUBSYSTEM:WINDOWS /OUT:main.exe